FROM alibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/alinux3:latest

LABEL \
        org.opencontainers.image.title="nginx_keentune" \
        org.opencontainers.image.version="latest" \
        maintainer="OpenAnolis KeenTune SIG"

COPY nginx_keentune.sh nginx_keentune.sh
COPY nginx.conf nginx.conf

RUN yum install nginx systemd procps-ng ethtool pciutils python36 polkit irqbalance git keentuned keentune-target -y
RUN pip3 install pynginxconfig pyudev requests -i https://pypi.tuna.tsinghua.edu.cn/simple \
    && mkdir /etc/pki/nginx/  /etc/pki/nginx/private -p \
    && /bin/bash -c "openssl req -x509 -sha256 -nodes -days 365 -newkey ec:<(openssl ecparam -name prime256v1) -keyout ecdsa.key -out ecdsa.crt -subj \"/C=CN/ST=Beijing/L=Beijing/O=Example Inc./OU=WebSecurity/CN=example1.com\"" \
    && mv ecdsa.crt /etc/pki/nginx/ \
    && mv ecdsa.key /etc/pki/nginx/private \
    && mv nginx.conf /etc/nginx/nginx.conf \
    && touch /usr/share/nginx/html/0kb.bin
